package com.aner.test.utils;

import com.aner.tester.utils.SpringBeanUtils;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;

/**
 * get i18n resource
 * 
 * @author aner
 */
public class I18nUtils
{
    /**
     * get message using spring messageSource
     *
     * @param code
     * @param args
     * @return
     */
    public static String message(String code, Object... args)
    {
        MessageSource messageSource = SpringBeanUtils.getBean(MessageSource.class);
        return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
    }
}
